/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
function cust_reg(){
    if( $('#cust_frm').validationEngine('validate') === false)return false;
    new backend({
        url         :   "/excution/addcustomer",
        data        :   $('#cust_frm').serialize(),
        callback    :   function(data){
            if(data.result<0){
                $('#cust_frm_err').html(data.message);
            }else{
                document.cust_frm.reset();
                $('#cust_frm_err').html('Đăng ký thành công.');
                login();
            }
            console.log(data);
        }
    }).call();
    return false;
}
function cust_login(){
    if( $('#login_frm').validationEngine('validate') === false)return false;
    new backend({
        url         :   "/excution/custlogin",
        data        :   $('#login_frm').serialize(),
        callback    :   function(data){
            if(data.result<0){
                $('#login_frm_err').html(data.message);
            }else{
                document.login_frm.reset();
                $('#login_frm_err').html('Đăng nhập thành công.');
                window.location.reload();
            }
            console.log(data);
        }
    }).call();
    return false;
}
function reg(){
    $('.jfk-bubble.regfrm').toggle();
    $('.jfk-bubble.loginfrm').hide()
}
function login(){
    $('.jfk-bubble.loginfrm').toggle();
    $('.jfk-bubble.regfrm').hide()
}
    
$(document).ready(function(){
	$('.services a div').hover(function(){
		$(this).stop().animate({top:'-172px'},200);
		//$(this).css({'background-position-y:':'-172px'});
		console.log('a');
	},function(){
		$(this).stop().animate({top:'0px'},200);
	});
    $('#cust_frm').validationEngine();
    $('#login_frm').validationEngine();
    try{
        $('.cycleSlider').cycle({ 

            timeout: 3000 ,
            pager:  '#cycleNav', 
            activePagerClass:'active',
            pagerAnchorBuilder: function(idx, slide) { 
                return '<a href="#">'+idx+'</a>'; 
            }
        });
    }catch(e){}
    
    Galleria.configure({
        transition: 'pulse',
        thumbCrop: 'width',
        imageCrop: false,
        carousel: false,
        show: false,
        easing: 'galleriaOut',
        fullscreenDoubleTap: false,
        trueFullscreen: false,
        imageMargin: 50
        
    });
    //Galleria.loadTheme('/libraries/galleria/themes/folio/galleria.folio.min.js');
    //$('.fontend_album.classic_album').css({height:300,width:'100%'});
    //Galleria.run('.fontend_album.classic_album');
    //theme : classic, azur, folio, twelve
    //‘fade’ crossfade betweens images
    //‘flash’ fades into background color between images
    //‘pulse’ quickly removes the image into background color, then fades the next image
    //‘slide’ slides the images depending on image position
    //‘fadeslide’ fade between images and slide slightly at the same time
    
});
